﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QuanLyKhachSan
{
    public partial class frmTimKiemHoaDonThuePhong : XtraForm
    {
        public string rdName,thongtintimkiem;

        public frmTimKiemHoaDonThuePhong()
        {
            InitializeComponent();
        }

        private void frmTimKiemHoaDonThuePhong_Load(object sender, EventArgs e)
        {
            this.nhanVienTableAdapter.Fill(this.qLKHACHSANDataSet.NhanVien);
            rdName = "";
            thongtintimkiem = "";
        }

        private void rd_Click(object sender, EventArgs e)
        {
            RadioButton rd = sender as RadioButton;
            rdName = rd.Name;
            switch (rdName)
            {
                case "rdFindByEmpID":
                    groupBox2.Visible = true;
                    cbNhanVien.Visible = true;
                    dtpNgayLap.Visible = false;
                    break;
                case "rdFindByDate":
                    groupBox2.Visible = true;
                    cbNhanVien.Visible = false;
                    dtpNgayLap.Visible = true;
                    break;
                case "rdFindAll":
                    groupBox2.Visible = false;
                    break;
            }
        }

        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            switch (rdName)
            {
                case "rdFindByEmpID":
                    thongtintimkiem = cbNhanVien.SelectedValue + "";
                    break;
                case "rdFindByDate":
                    thongtintimkiem = dtpNgayLap.Value.ToShortDateString();
                    break;
            }
            if (rdName=="")
            {
                MessageBox.Show("Chưa chọn tiêu chí tìm kiếm");
            }
            else if (rdName=="rdFindAll")
            {
                this.Close();
            }
            else if (thongtintimkiem=="")
            {
                MessageBox.Show("Chưa nhập thông tin tìm kiếm");
            }
            else
            {
                this.Close();
            }
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            rdName = "";
            thongtintimkiem = "";
            this.Close();
        }
    }
}
